#include<iostream>
using namespace std;
typedef long long LL;
const int N = 15;
LL a[N];
int n;
LL fun(LL a, LL b)
{
	LL ans = 1;
	while (b) {
		if (b & 1)ans *= a;
		b >>= 1;
		a = a * a;
	}
	return ans;
}
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)cin >> a[i];
	LL ans = 0;
	for (int i = 1; i <= n; i++) {
		LL b = a[i] % 10;
		LL x = a[i] / 10;
		ans += fun(x, b);
	}
	cout << ans << endl;
	return 0;
}